<?php

namespace App\Http\Controllers\Manage;

use App\Helpers\ResponseData;
use App\Http\Controllers\Controller;
use App\Models\CompanyCategory;
use App\Models\Department;
use Illuminate\Http\Request;

class CompanyCategoryController extends Controller
{
    use ResponseData;
    public function list(CompanyCategory $model,Request $request){
        $data = $model->orderBy('id','desc')->get();
        return $this->success($data);
    }
    public function store(CompanyCategory $model,Request $request){
        $data = $request->all();
        $model->fill($data);
        $model->save();
        return $this->success('保存成功');
    }
    public function edit(CompanyCategory $model,Request $request){
        $data = $model->find($request->id);
        return $this->success($data);
    }
    public function update(CompanyCategory $model,Request $request){
        $data = $model->find($request->id);
        $data->update($request->all());
        return $this->success('修改成功');
    }
    public function destory(CompanyCategory $model,Request $request){
        $data = $model->find($request->id);
        $data->delete();
    }
}
